You can always find the latest version on my web page: http://www.infoworkshop.com/~jonpugh/
Free for noncommercial use.
Contact me for a simple cheap license if you wish to include any or all of these as part of a software solution that you sell.
This AppleScript scripting addition provides AppleScript and all scriptable and Apple Event aware applications with added functionality. To examine the AppleScript syntax of each of these commands, simply drag Jon’s Commands onto the Script Editor or use the Open Dictionary command to open it. To install it, simply drop it into the Scripting Additions folder which is inside your Extensions folder.
The file “Jon’s Commands Reference” is an Apple Guide file. It contains a quick reference of all the commands’ syntax, examples and explanations. It is designed to be used in your script editor. You install it by placing it or an alias to it in the same folder as your script editor. “Jon’s Commands Reference” will then appear in the help menu on the right side of your menu bar. This guide is especially useful with Script Debugger, available from Late Night Software, since that editor is scriptable. In all other editors, when you press the Copy button a copy of the current command’s complete syntax is placed on the clipboard for you to paste into your script. In Script Debugger, the text will be placed directly into the front script window, without the annoying switch to the Finder and back which is necessary with the other editors. Jon’s Commands needs to be installed for the Copy feature to work properly with any editor besides Script Debugger, as does the scriptable Finder.
Jon’s Commands includes these commands:
deleteFile - delete a file, empty folder or a list of files and/or empty folders
renameFile - rename a file or folder
moveFile - move a file, folder or a list of files and/or folders to another folder
copyFile - copy a file, folder or a list of files and/or folders
sound volume - get the volume setting
set sound volume to - set the volume setting
clipboard info - get a list of data on the clipboard
set the clipboard to - put data on the clipboard
the clipboard - get data from the clipboard
execute FKEY - run an FKEY resource
screen list - describe the monitor configuration
finder selection - return the Finder’s selection
keys pressed - get a list of pressed keys
machine environment - get info about the machine via Gestalt
play sound - play sound resources, files and descriptors
run script resource - run an ‘Scpt’ or ‘scpt’ script resource
free memory - return the free memory available
the ticks - return the current value of tickCount
walk folders - walk folders and run a script on each file
set cursor to - provide feedback with the cursor
AE user interaction level - control the interaction level
choose color - use the color picker to select a color
keyboard lights - get and set the lights on the extended keyboard
snag object - save an object specifier into a resource file
alias information - get information about an alias
Jon’s Commands includes these objects:
picture - for getting them off the clipboard «class PICT»
sound - for getting them off the clipboard & playing them «class snd »
screen info object - for describing the monitors
environment info object - for describing the machine
alias info object - for describing an alias
Jon’s Commands includes these coercions:
string to file specification - ‘TEXT’ to ‘fss ’
styled text to file specification - ‘STXT’ to ‘fss ’
international text to file specification - ‘itxt’ to ‘fss ’
Version History:
1.0b1 - first public release
1.0b2 - fixed key name in “keys pressed” for PowerBook keyboard.
1.0b3 - added 7.1.1 to version check for “finder selection”.
1.0b4 - added “run script resource” command.
1.0b5 - added “free memory” and “the ticks” commands.
1.0 - official release.
1.1b1 - added “copyFile” command. Made “moveFile”, “deleteFile”, “renameFile” & “copyFile” accept lists of files, aliases or pathnames. Added string to file specification coercion.
1.1b2 - fixed bug in “set clipboard to” which could cause changes to the clipboard to be unnoticed and fixed a really minor bug in “execute FKEY” which passed a dirty PC to the FKEY in 24 bit mode.
1.1b3 - added “walk folders” command, made “finder selection” return aliases for AS 1.0 compatibility and made “screen list” work without color QuickDraw.
1.1 - official release
1.1.1b1 - fixed “machine environment” property name conflict with “machine” by renaming it “machine type” and actually implemented the “cpu type” property. Also fixed the sample script for “walk folders” above.
1.1.1b2 - fixed “execute fkey” error handling, twiddled clipboard code to remove debugger calls & clean up the code a bit, fixed “finder selection” when items were on desktop of volumes other than the startup volume & made “walk folders” send an alias instead of a file specification for compatibility with AS 1.0.
1.1.1b3 - fixed error handler in “play sound”.
1.1.1 - official release
1.1.2b1 - made string to fsspec coercion more picky so that it doesn’t confuse the “run script” osax.
1.1.2 - official release
1.1.3b1 - recompiled with debugger breaks off. Ooops.
1.1.3 - official release
1.2b1 - added “set cursor to” command.
1.2b2 - added “AE user interaction level” function.
1.2 - official release
1.3b1 - added “only using files of type” parameter to “walk folders” command.
1.3 - official release
1.3.1b1 - made aete unpurgeable to avoid Script Editor dictionary bug.
1.3.1 - official release
1.3.2b1 - added “scriptable Finder” to “machine environment” record.
1.3.2b2 - added additional acur and CURS resources and spruced up the readme.
1.3.2b3 - made “copyFile” delete the temp file even if FSpExchangeFile fails. Also fixed memory leak in “keys pressed”.
1.3.2b4 - honest, this time “copyFile” is fixed. It was FSpDelete that was failing.
1.3.2b5 - replaced guts of “copyFile” with MoreFiles code. Now it works with drop boxes. Spruced up the readme some more.
1.3.2 - official release
1.3.3b1 - Made clipboard commands error when in the background.
1.3.3b2 - Fixed “copyFile” problem when replacing a nonexistent file.
1.3.3 - official release
1.3.4b1 - Made “walk folders” command step backwards through folders.
1.3.4b2 - Made “copyFile” fail when copying to a nonexistant directory.
1.3.4b3 - Made “copyFile” return better errors when files and directories are missing. Zeroed location when not replacing so that the Finder will put the icon in the first empty spot.
1.3.4b4 - Made “copyFile” copy folders too.
1.3.4 - official release
1.3.5b1 - Fixed “copyFile” bug when copying file to file with a different name.
1.3.5 - official release
1.3.6b1 - Made replacing parameter on “copyFile” accept yes/no/ask & error when used with directories.
1.3.6b2 - Fixed “walk folders” bug when walking folders; files were fine.
1.3.6b3 - Fixed “finder selection” crash when trash is selected. There are probably still problems with selecting PowerTalk or GX items which are not files.
1.3.6b4 - Added “check bit” parameter to “machine environment” command.
1.3.6 - official release
1.3.7b1 - Fixed some comments in the dictionary. Changed the “check bit” parameter of “machine environment” command to be zero based instead of one based, making it compatible with Inside Mac. This affects scripts!
1.4b2 - Added “choose color” command. Wondered if this change log was worth the bother. It’s kind of embarassing, but I guess it’s educational. I hope. :) Changed the version to 1.4 since we added a command.
1.4b3 - Added “owner name” and “sharing name” properties to “machine information” record.
1.4b4 - Fixed “CPU type” and “FPU” to work properly with PowerPC machines and added “PowerPC” property. Added description and examples for “screen list” command to this document. It was always missing and no one noticed.
1.4 - official release
1.5b1 - Made everything compile with MPW Pro and the new headers. Made “moveFile” support the Finder’s Put Away command. Added “Jon’s Commands Reference” guide file to the package. Added “set screens to” command.
1.5b2 - Added “with unlocking” parameter to “deleteFile” command so it can delete locked files. Made “set screens to” command persistent when running Display Manager 2. Beefed up the examples and moved them to a new file, “Jon’s Commands Notes” to avoid the 32K limit of SimpleText.
1.5b3 - included Display Enabler for Display Manager 2.
1.5 - official release
1.5.1b1 - Reverted to 1.4’s “finder selection” command because the new sc compiler appears to have changed the object layout so that it doesn’t match the Finder’s objects anymore and thus doesn’t work in 1.5. Also ditched the Display Library as it isn’t needed.
1.5.1 - official release
1.6b1 - Added "keyboard lights" command.
1.6 - official release
1.7b1 - Added **** to TEXT coercion.
1.7b2 - Added "snag object" command.
1.7b3 - Added a couple more parameters to the "snag object" command. Removed the Display Enabler since it’s too big and available seperately.
1.7b4 - Removed the **** to TEXT coercion because of its lack of usefulness and potential for engendering confusion.
1.7 - official release
1.7.1b1 - Fixed moveFile for multiple files and put away functionality.
1.7.1b2 - Added this comment for you comment aficionados.
1.7.1 - official release
1.7.2b1 - Reworked ordering of “walk folder” execution so that deleting files & folders is possible. Made “deleteFile” delete folders recursively.
1.7.2 - official release
1.8b1 - Added “alias information” command.
1.8b2 - Futzed with it.
1.8b3 - ++futz
1.8b4 - Made “machine environment” handle missing machine or owner name safely.
1.8b5 - Made “walk folders” return errors from the script properly (they were all -1753 before).
1.8 - official release
1.8.1b1 - Made “machine environment” recognize PowerBook keyboards and 603e, 603ev and 604e processors.
1.8.1b2 - Fixed missing watch cursor from animated cursor in “set cursor to” command. Changed a bunch of the ids for resources just in case since they might conflict with application resources when embedding osaxen. Now they’re all in wackier ranges. This could affect scripts! This could affect the “set cursor to” command in your scripts iff you refer to cursor lists by number instead of by name. Made “play sound” recognize alias files.
1.8.1b3 - Shortened the copyFile temp file name so that it couldn’t get too long & recompiled with MoreFiles 1.4.3.
1.8.1 - official release
Feel free to send money or to write with questions, comments or suggestions.